import request from "@/utils/request";

export function getSimple() {
  return request({
    url: "/sys/user/simple",
    method: "get"
  });
}

// 获取所有员工
export function getEmpList(params) {
  return request({
    url: "/sys/user",
    params
  });
}

// 删除员工

export function delEmp(id) {
  return request({
    url: `/sys/user/${id}`,
    method: "delete"
  });
}
// 添加员工
export function addEmple(data) {
  return request({
    url: `/sys/user`,
    method: "post",
    data
  });
}

// 批量导入员工数据
export function batchEmp(data) {
  return request({
    url: `/sys/user/batch`,
    method: "post",
    data
  });
}

// 查看员工

export function saveProfile(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: "put",
    data
  });
}

// 保存员工的个人信息
export function savePersonalInfo(data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: "PUT",
    data
  });
}

// 获取员工的个人信息
export function getPersonalInfo(id) {
  return request({
    url: `/employees/${id}/personalInfo`,
    method: "get"
  });
}

//获取员工岗位信息

export function getJobList(id) {
  return request({
    url: `/employees/${id}/jobs`,
    method: "get"
  });
}
// 修改员工岗位信息
export function editJobList(data) {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: "put",
    data
  });
}

/**
 * 设置员工的角色
 * @param {*} data 一个对象，里面包含员工id和角色的id数组
 */
export function setRoles(data) {
  return request({
    url: "/sys/user/assignRoles",
    method: "put",
    data
  });
}
